import requests


url = 'https://m.ctrip.com/restapi/soa2/21221/globalSearch'

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
    'x-ta-uid': '8d27a6f1-a5c5-4929-8b24-3f4c6e84a37f,',
    'content - type': 'application / json;charset:utf - 8;',
    'origin': 'https: // www.tripadvisor.cn',
    'referer': 'https: // www.tripadvisor.cn / Search?q = % E5 % 8D % A1 % E7 % 89 % B9 & searchSessionId = 37BF7B47386F0713A4184F78A2279C431634106184993ssid & searchNearby = false',
}
data = {
    'keywords': ' "卡特"',
    'lat': ' ""',
    'lon': '""',
    'pageNo': '1',
    'pageSize': '30',
}
resp = requests.post(url=url, headers=headers, data=data)
data_json = resp.json()
lis = data_json['result']['hits']
# print(len(lis))
for item in lis:
    name = item['name']     # 名字

    comments = item['totalComments']        # 总评论数

    description = item['description']
    print(name, comments)